﻿
Partial Class ProductsPage
    Inherits System.Web.UI.Page

    Protected Sub btnaddtocart_Click(sender As Object, e As System.EventArgs)
        Dim data As String = CType(sender, Button).CommandArgument
        'split data to get product elements
        Dim prod As String() = data.Split("|".ToCharArray)
        Dim newitem As New Product()
        newitem.ID = Utility.GetValidInt(prod(0))
        newitem.Name = Utility.GetValidString(prod(1))
        newitem.Desc = Utility.GetValidString(prod(2))
        newitem.ImagePath = Utility.GetValidString(prod(3))
        newitem.CanPersonalize = If(Utility.GetValidString(prod(4)).ToLower = "true", True, False)
        newitem.Amount = Utility.GetValidDouble(prod(5))
        UserCart.AddtoCart(newitem)
        CType(Me.Master.FindControl("lblCartSummary"), Label).Text = CType(Session("MyCart"), CartProducts).GetItemCount()
    End Sub
End Class
